﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=203",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "../system/error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$203");
                    tabs.removeTab(tab);
                }
            }
        });
        var States = [{ id: 0, text: '未审核' }, { id: 1, text: '已审通过' }, { id: 2, text: '已审未通过' }, { id: -1, text: "全部"}];
        var State = [{ id: 0, text: '未审核' }, { id: 1, text: '<font color="Green">已审通过</font>' }, { id: 2, text: '<font color="Red">已审未通过</font>'}];
    </script>
</head>
<body>
    <div class="mini-toolbar" style="border-bottom: 0;">
        <table>
            <tr>
                <td>
                    名称：
                    <input class="mini-textbox" id="key" style="width: 150px;" emptytext="用户名或真实姓名关键字" />
                    状态：
                    <input id="state" class="mini-combobox" style="width: 100px;" data="States" value="0"/>
                    <a class="mini-button" iconcls="icon-search" plain="true" onclick="search();">查询</a>
                    <span class="separator"></span>
                    <a class="mini-button" plain="true" iconcls="icon-ok" onclick="checkRows(1)">审核通过</a>
                    <a class="mini-button" plain="true" iconcls="icon-no" onclick="checkRows(2)">审核不通过</a>
                    <a class="mini-button" iconcls="icon-remove" plain="true" onclick="delRows()">删除</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit" >
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" allowresize="true"
            idfield="id" multiselect="true" url="../data/system.aspx?method=GetPerHighList" sizeList="[15,20,50,100]" pageSize="15">
            <div property="columns">
                <div type="checkcolumn">
                </div>
                <div cellCls="actionIcons" name="action" width="50px" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</div>
                <div field="pi_name" width="100px" headeralign="center" align="center" allowsort="true" renderer="onNameRenderer">
                    真实姓名</div>
                <div field="pi_highstate" width="80px" headeralign="center" align="center" allowsort="true" renderer="onStateRenderer">
                    高级人才状态</div>
                <div field="pi_college" width="100px" headeralign="center" align="center" allowsort="true">
                    毕业院校</div>
                <div field="spcode" width="120px" headeralign="center" align="center" allowsort="true" renderer="onSpCodeRenderer">
                    专业</div>
                <div field="edu" width="50px" headeralign="center" align="center" allowsort="true">
                    学历</div>
                <div field="pi_state" width="50px" headeralign="center" align="center" allowsort="true" renderer="onStateRenderer">
                    会员状态</div>
                <div field="pi_pic" width="50px" headeralign="center" align="center" allowsort="true" renderer="onPicRenderer">
                    照片</div>
                <div field="pi_loginnum" width="50px" headeralign="center" align="center" allowsort="true">
                    登录次数</div>
                <div field="pi_logintime" width="120px" headeralign="center" align="center" allowsort="true" dateformat="yyyy-MM-dd HH:mm:ss">
                    最后登录时间</div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            complete: function (XMLHttpRequest, textStatus) {
                if (XMLHttpRequest.responseText == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                }
            }
        });

        mini.parse();

        var grid = mini.get("datagrid1");
        search();

        function search() {
            var state = mini.get("state").getValue();
            var key = mini.get("key").getValue();
            grid.load({ state: state, key: key });
            grid.sortBy("pi_no", "desc");
        }

        function onActionRenderer(e) {
            var s = '<span class="icon-remove actionspan" title="删除" onclick="delRow(' + e.record._uid + ')"></span>';
            return s;
        }

        function onNameRenderer(e) {
            var s = '<a class="linelink" target="_blank" href="../../Web/Person/' + e.record.pi_no + '.html" title="编  号：' + e.record.pi_no + '&#13用户名：' + e.record.pi_user + '">' + e.record.pi_name + '</a>';
            //var s = '<a class="linelink" title="编  号：' + e.record.pi_no + '&#13用户名：' + e.record.pi_user + '">' + e.record.pi_name + '</a>';
            if (e.record.pi_hide == 0)
                s = s + '[<font color="Green">简历开启</font>]';
            else if (e.record.pi_hide == 1)
                s = s + '[<font color="Red">简历关闭</font>]';
            else if (e.record.pi_hide == 2)
                s = s + '[简历半开启]';
            return s;
        }

        function onStateRenderer(e) {
            for (var i = 0; i < State.length; i++) {
                var s = State[i];
                if (s.id == e.value)
                    return s.text;
            }
            return "";
        }

        function onSpCodeRenderer(e) {
            var s = e.record.spcode;
            if (e.record.pi_sp != null && e.record.pi_sp != "")
                s = s + '(' + e.record.pi_sp + ')';
            return s;
        }

        function onPicRenderer(e) {
            var s = '未上传';
            if (e.record.pi_pic != null && e.record.pi_pic != "")
                s = '<a class="linelink" target="_blank" href="' + e.record.pi_pic + '">查看</a>';
            return s;
        }

        function delRow(row_uid) {
            var row = grid.getRowByUID(row_uid);
            if (row) {
                mini.confirm("确定删除此高级人才吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            var messageid = mini.loading("删除中，请稍后......", "系统提示");
                            $.ajax({
                                url: "../data/system.aspx?method=DeletePerHigh",
                                type: "post",
                                data: { id: row.pi_no },
                                success: function (ret) {
                                    mini.hideMessageBox(messageid);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "高级人才删除成功！", 1);
                                        grid.reload();
                                    }
                                    else
                                        ShowMessage("系统提示", "高级人才删除失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.hideMessageBox(messageid);
                                    ShowMessage("系统提示", "高级人才删除失败！", 3);
                                }
                            });
                        }
                    }
                );
            }
        }

        function checkRows(state) {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                mini.confirm("确定审核所选高级人才吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            var messageid = mini.loading("操作中，请稍后......", "系统提示");
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].pi_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=CheckPerHigh",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.hideMessageBox(messageid);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "高级人才审核成功！", 1);
                                        grid.reload();
                                    }
                                    else
                                        ShowMessage("系统提示", "高级人才审核失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.hideMessageBox(messageid);
                                    ShowMessage("系统提示", "高级人才审核失败！", 3);
                                }
                            });
                        }
                    });
                } 
            else
                ShowMessage("系统提示", "请选择需要审核的高级人才！", 2);
        }

        function delRows() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                mini.confirm("确定删除所选高级人才吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            var messageid = mini.loading("删除中，请稍后......", "系统提示");
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].pi_no + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=DeletePerHigh",
                                type: "post",
                                data: { id: ids },
                                success: function (ret) {
                                    mini.hideMessageBox(messageid);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "高级人才删除成功！", 1);
                                        grid.reload();
                                    }
                                    else
                                        ShowMessage("系统提示", "高级人才删除失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.hideMessageBox(messageid);
                                    ShowMessage("系统提示", "高级人才删除失败！", 3);
                                }
                            });
                        }
                    });
                } 
            else
                ShowMessage("系统提示", "请选择需要删除的高级人才！", 2);
        }
    </script>
</body>
</html>